#ifndef __FILTER_H
#define __FILTER_H

#include "math.h"
#include "app_include.h"

typedef struct
{
	float *queue;
	uint32_t current_width;
	uint32_t window_width;
	uint32_t index;
	float sum;
}move_window_filter_t;

typedef struct
{
	float alpha;
	float last_z;
	float z;
	float highpass_last_x;
}complementary_filter_t;


float move_window_filter(move_window_filter_t *filter,float input);
float complementary_filter(complementary_filter_t *filter,float low_y,float high_x);



void IntegralFixFilter_Calculate(void *arg);
void DifferentialFixFilter_Calculate(void *arg);
float Interpolation_Derivation_FivePointFunction(float *fx,float period);
float LowpassFilter_Tustin(float Ts,float Yn,float Xn_1,float Xn);
float LowpassFilter(float Ts,float Omega_c,float Yn,float Xn_1,float Xn);
float Deathzoom(float input,float center,float width);
float Signnorm(float input,float center);
float Ramp(float now,float target,float step);
float HighpassFilter(float Ts,float Omege_c,float Yn,float Xn_1,float Xn);
float MoveAverageFilter(float* data,uint16_t cnt);
float MTF02_DistanceFilter(float last_data,uint32_t raw_data,uint8_t quality);
#endif



